import request from "@/utils/request";

export function uploadFile(file, url) {
  var formdata = new FormData();
  formdata.append("file", file, file.name);

  var requestOptions = {
    method: "POST",
    body: formdata,
  };

  return fetch(url, requestOptions);
  // .then(response => response.text())
  // .then(result => console.log(result))
  // .catch(error => console.log('error', error));
  // return request({
  //   url: "/file/upload",
  //   method: "post",
  //   data: query,
  // });
}

export function getPolicy(fileName, fileType) {
  let query = {
    fileName: fileName,
    fileType: fileType,
  };
  return request({
    url: "/file/policy",
    method: "get",
    params: query,
  });
}
